package com.totowoo.shirodemo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.totowoo.shirodemo.dao.PermissionDao;
import com.totowoo.shirodemo.model.Permission;
import com.totowoo.shirodemo.service.PermissionService;

@Service("permissionService")
public class PermissionServiceImpl implements PermissionService {
	
	@Autowired
	private PermissionDao permissionDao;

	@Override
	public List<Permission> getPermissionList() {
		return permissionDao.getPermissionList();
	}

	@Override
	public Permission addPermission(Permission permission) {
		try {
			permissionDao.addPermission(permission);
			return permission;
		} catch(Exception e) {
			e.printStackTrace();
			return null;
		}
	}

	@Override
	public Permission getPermissionById(int id) {
		return permissionDao.getPermissionById(id);
	}

}
